fix: honor Fetch.enable urlPattern patterns - #6
Open
lgwacker wants to merge 3 commits into
Open
Conversation
lgwacker
marked this pull request as draft
August 12, 2026 18:57
The previous fix only patched Fetch.enable patterns into the Browser.requestIntercepted handler, but that event does not exist in the Juggler protocol. Requests are paused via the per-page NetworkObserver, which emits Network.requestWillBeSent with an isIntercepted flag. - Fetch.enable -> Network.setRequestInterception (page session) - Fetch.continueRequest -> Network.resumeInterceptedRequest - Fetch.fulfillRequest -> Network.fulfillInterceptedRequest - Fetch.failRequest -> Network.abortInterceptedRequest - emit Fetch.requestPaused from Network.requestWillBeSent when isIntercepted is set; auto-continue non-matching patterns
Verified against Camoufox 135 (omni.ja): enabling Network.setRequestInterception pauses every request (channelIntercepted stores them in _interceptedRequests) but PageNetwork.Events.Request is never delivered to the PageHandler in the browser process — no Network.requestWillBeSent, no isIntercepted, nothing resumes the paused requests. Navigation stalls forever (Page.navigate returns navigationId, frameNavigated never arrives). Fetch.enable is now a no-op (patterns still remembered for a future Juggler fix): dialog interception is degraded, but pages load. This unblocks every CDP client that enables Fetch (e.g. Hermes dialog-bridge supervisor).
lgwacker
marked this pull request as ready for review
August 12, 2026 21:12
Author
|
FYI — the complete fix set now lives on lgwacker/foxbridge main ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5.
Problem
Fetch.enablewithurlPatternpatterns was translated to Juggler'sBrowser.setRequestInterceptionwith only{enabled: true}— the patterns were dropped. Every request in the browser got intercepted (paused) instead of only pattern-matching ones, so clients that scopeFetch.enableto a single URL had all navigation requests paused forever:Page.navigatereturned anavigationIdbut noframeNavigatedever fired, because non-matching requests waited for aFetch.continueRequestthat never came.Changes
pkg/bridge/fetch.go—Fetch.enablenow parsesparams.Patterns, extracts each entry'surlPattern, and stores the list per CDP session inBridge.fetchPatterns(mutex-guarded, matching the existing per-map mutex pattern). No patterns →nil→ intercept everything (unchanged behavior).Fetch.disableclears the entry. Added aglobMatch(pattern, url)helper (glob*= any sequence, case-insensitive, anchored full-URL match).pkg/bridge/events.go— theBrowser.requestInterceptedhandler now checks the session's patterns and auto-continues (Browser.continueInterceptedRequest) any request whose URL matches no pattern, skippingNetwork.requestWillBeSent/Fetch.requestPausedfor it. Matching requests (or sessions with no patterns) keep the current pause-and-emit path.pkg/bridge/bridge.go— addedfetchPatternsMu/fetchPatternsfields and map init.Verification
go buildpasses (golang:1.26 container) andgofmt -lis clean.Notes
*, case-insensitive, full-URL match.Fetch.enableare unaffected.